package 图书系统.user.operation;

import 图书系统.user.book.BookList;

import java.util.Scanner;

public class FindOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        //查找书籍
        System.out.println("<查找书籍>");
        System.out.println("请输入你要找的书名");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        int i;
        for (i = 0; i < bookList.getCount(); i++) {
            if(name.equals(bookList.getArr(i).getName())){
                break;
            };
        }
        if(i>=bookList.getCount()){
            System.out.println("没有找到！");
        }else {
            System.out.println("找到了！");
            System.out.println(bookList.getArr(i));
        }

    }
}
